package com.itheima.tlias84;

import com.itheima.tlias84.entity.Teacher;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

/**
 * 通过@Bean创建的bean对象，默认是该Bean的方法名
 * 一般用于自动配置第三方对象的连接信息对象，例如：阿里云OSS
 */
@SpringBootApplication
public class Tlias84Application {

    public static void main(String[] args) {
        SpringApplication.run(Tlias84Application.class, args);
    }

    //手动装载

    /**
     * 通过@Bean注解创建的bean对象，默认是该bean的方法名
     */
    @Bean("大白")
    public Teacher createTeacherOne() {
        Teacher teacher = new Teacher();
        teacher.setName("大白");
        teacher.setAge(2);
        return teacher;
    }

    @Bean("三千")
    public Teacher createTeacherTwo() {
        Teacher teacher = new Teacher();
        teacher.setName("三千");
        teacher.setAge(3);
        return teacher;
    }


}
